// Detecting (most) unknown functions, based
// on the pattern "non-numerical-character
// + \\w* + (" i.e. lack of whitespace between
// a word and immediately following (opening)
// parenthesis. Note that a lot of documented
// functions get "processed" and don't feature
// in this list, which is being generated to
// aid manually accommodating some missed-out
// but frequently occurring functions in some
// other log (other than the sample!) :)
map<string,unsigned> unaccounted;

// Note down unknown functions encountered
// into a file called "functions.txt"...
void list_unknown_functions( const int& argument ){

	// T02: Provide the choice to remove
	// or "substitute" those functions.

	ofstream functions;
	if( argument > 1 ) functions.open( "functions.txt", ofstream::app );
	else functions.open( "functions.txt" );
	if( !functions.is_open() ){
		cerr << "Unable to open file!" << endl;
		assert( functions.is_open() );
	}

	// Mostly, repeated function names (and unknown parameter types) mess up the
	// statistics. Hence, we have tried to cover most functions noted in the
	// documentation (based on the oft-used "categories" in the sample log file).
	for( string_count_pair new_fn: unaccounted )
		functions << new_fn.first << " " << new_fn.second << endl;

}
